package main

import (
	"fmt"
	"reflect"
)

func reverse(s []int) {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
}

func equal(a, b []int) bool {
	if len(a) != len(b) {
		return false
	}
	for i := range a {
		if a[i] != b[i] {
			return false
		}
	}
	return true
}

func main() {
	a := [...]int{1, 2, 3, 4, 5} //a是数组
	reverse(a[:])                //reverse函数要求参数为切片，所以需要将数组转换为切片
	fmt.Println(a)               //a依然是数组
	fmt.Println(reflect.TypeOf(a))

	b := []int{1, 2, 3, 4, 5} //b是切片
	reverse(b)
	fmt.Println(b)
	fmt.Println(reflect.TypeOf(b))
}
